package gwtool.gui.konfliktmanager;

import javax.swing.JPanel;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.border.TitledBorder;

public class KonfliktmanagerView extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5131798546998716760L;

	private JPanel buttonpanel;

	private JPanel lokalespanel;

	private JPanel onlinepanel;

	private JButton btnKonfliktlocalloesen;

	private JButton btnKonfliktonlineloesen;

	private KonfliktController controller;

	private JPanel panel;

	private JPanel panel_1;

	public KonfliktmanagerView(KonfliktController konfliktController) {

		this.controller = konfliktController;
		initialize();
	}

	private void initialize() {

		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] { 0, 0, 0 };
		gridBagLayout.rowHeights = new int[] { 0, 0, 29, 0 };
		gridBagLayout.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
		gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE };
		setLayout(gridBagLayout);
		GridBagConstraints gbc_panel = new GridBagConstraints();
		gbc_panel.fill = GridBagConstraints.BOTH;
		gbc_panel.insets = new Insets(0, 0, 5, 5);
		gbc_panel.gridx = 0;
		gbc_panel.gridy = 0;
		add(getPanel(), gbc_panel);
		GridBagConstraints gbc_panel_1 = new GridBagConstraints();
		gbc_panel_1.fill = GridBagConstraints.BOTH;
		gbc_panel_1.insets = new Insets(0, 0, 5, 0);
		gbc_panel_1.gridx = 1;
		gbc_panel_1.gridy = 0;
		add(getPanel_1(), gbc_panel_1);
		GridBagConstraints gbc_buttonpanel = new GridBagConstraints();
		gbc_buttonpanel.insets = new Insets(0, 0, 5, 0);
		gbc_buttonpanel.gridwidth = 2;
		gbc_buttonpanel.fill = GridBagConstraints.BOTH;
		gbc_buttonpanel.gridx = 0;
		gbc_buttonpanel.gridy = 1;
		add(getButtonpanel(), gbc_buttonpanel);
	}

	private JPanel getButtonpanel() {

		if (buttonpanel == null) {
			buttonpanel = new JPanel();
			GridBagLayout gbl_buttonpanel = new GridBagLayout();
			gbl_buttonpanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
			gbl_buttonpanel.rowHeights = new int[] { 0, 0 };
			gbl_buttonpanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
					Double.MIN_VALUE };
			gbl_buttonpanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
			buttonpanel.setLayout(gbl_buttonpanel);
		}
		return buttonpanel;
	}

	public JPanel getLokalespanel() {

		if (lokalespanel == null) {
			lokalespanel = new JPanel();
			GridBagLayout gbl_lokalespanel = new GridBagLayout();
			gbl_lokalespanel.columnWidths = new int[] { 0 };
			gbl_lokalespanel.rowHeights = new int[] { 0 };
			gbl_lokalespanel.columnWeights = new double[] { Double.MIN_VALUE };
			gbl_lokalespanel.rowWeights = new double[] { Double.MIN_VALUE };
			lokalespanel.setLayout(gbl_lokalespanel);
		}
		return lokalespanel;
	}

	public JPanel getOnlinepanel() {

		if (onlinepanel == null) {
			onlinepanel = new JPanel();
			GridBagLayout gbl_onlinepanel = new GridBagLayout();
			gbl_onlinepanel.columnWidths = new int[] { 0 };
			gbl_onlinepanel.rowHeights = new int[] { 0 };
			gbl_onlinepanel.columnWeights = new double[] { Double.MIN_VALUE };
			gbl_onlinepanel.rowWeights = new double[] { Double.MIN_VALUE };
			onlinepanel.setLayout(gbl_onlinepanel);
		}
		return onlinepanel;
	}

	public JButton getBtnKonfliktlocalloesen() {

		if (btnKonfliktlocalloesen == null) {
			btnKonfliktlocalloesen = new JButton("Konflikt mit dem lokalem Datensatz l\u00F6sen");
			btnKonfliktlocalloesen.addActionListener(controller);
		}
		return btnKonfliktlocalloesen;
	}

	public JButton getBtnKonfliktonlineloesen() {

		if (btnKonfliktonlineloesen == null) {
			btnKonfliktonlineloesen = new JButton("Konflikt mit dem online Datensatz l\u00F6sen");
			btnKonfliktonlineloesen.addActionListener(controller);
		}
		return btnKonfliktonlineloesen;
	}

	private JPanel getPanel() {

		if (panel == null) {
			panel = new JPanel();
			panel.setBorder(new TitledBorder(null, "Lokales DataSet", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			GridBagLayout gbl_panel = new GridBagLayout();
			gbl_panel.columnWidths = new int[] { 0, 0 };
			gbl_panel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
			gbl_panel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
			gbl_panel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
					0.0, Double.MIN_VALUE };
			panel.setLayout(gbl_panel);
			GridBagConstraints gbc_lokalespanel = new GridBagConstraints();
			gbc_lokalespanel.fill = GridBagConstraints.BOTH;
			gbc_lokalespanel.gridheight = 15;
			gbc_lokalespanel.insets = new Insets(0, 0, 5, 0);
			gbc_lokalespanel.gridx = 0;
			gbc_lokalespanel.gridy = 0;
			panel.add(getLokalespanel(), gbc_lokalespanel);
			GridBagConstraints gbc_btnKonfliktlocalloesen = new GridBagConstraints();
			gbc_btnKonfliktlocalloesen.gridx = 0;
			gbc_btnKonfliktlocalloesen.gridy = 15;
			panel.add(getBtnKonfliktlocalloesen(), gbc_btnKonfliktlocalloesen);
		}
		return panel;
	}

	private JPanel getPanel_1() {

		if (panel_1 == null) {
			panel_1 = new JPanel();
			panel_1.setBorder(new TitledBorder(null, "Online DataSet", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			GridBagLayout gbl_panel_1 = new GridBagLayout();
			gbl_panel_1.columnWidths = new int[] { 0, 0 };
			gbl_panel_1.rowHeights = new int[] { 0, 0, 0 };
			gbl_panel_1.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
			gbl_panel_1.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
			panel_1.setLayout(gbl_panel_1);
			GridBagConstraints gbc_onlinepanel = new GridBagConstraints();
			gbc_onlinepanel.insets = new Insets(0, 0, 5, 0);
			gbc_onlinepanel.fill = GridBagConstraints.BOTH;
			gbc_onlinepanel.gridx = 0;
			gbc_onlinepanel.gridy = 0;
			panel_1.add(getOnlinepanel(), gbc_onlinepanel);
			GridBagConstraints gbc_btnKonfliktonlineloesen = new GridBagConstraints();
			gbc_btnKonfliktonlineloesen.gridx = 0;
			gbc_btnKonfliktonlineloesen.gridy = 1;
			panel_1.add(getBtnKonfliktonlineloesen(), gbc_btnKonfliktonlineloesen);
		}
		return panel_1;
	}
}
